package com.ncu.week5_listview_l9;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.KeyboardShortcutGroup;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.week5.R;

import java.util.List;

//自定义对话框类
public class DetailDialog extends Dialog implements View.OnClickListener{
    private TextView tvMsg;
    private TextView btnOk;
    private  String msg;

    public DetailDialog(Activity a, String message){
        super(a);
        msg = message;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.dialog_detail);
        btnOk = (TextView)findViewById(R.id.btn_ok);
        tvMsg = (TextView)findViewById(R.id.tv_msg);
        btnOk.setOnClickListener(this);
        tvMsg.setText(msg);
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_ok:
                //消除
                dismiss();
                break;
            default:
                break;
        }
    }


}
